﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace DyUi.Interfaces
{
    public class Folder : IFolder
    {
        public string FolderLabel { get; private set; }
        public string FullPath { get; private set; }
        public IEnumerable<IFolder> Folders { get; private set; }

        private Folder() { }

        internal static Folder CreateInstance(string dir, IEnumerable<IFolder> folders)
        {
            return new Folder()
            {
                FolderLabel = GetFolderLabel(dir),
                FullPath = dir,
                Folders = folders
            };
        }

        private static string GetFolderLabel(string fullPath)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(fullPath);
            return dirInfo.Name;
        }
    }

    public interface IFolder
    {
        string FullPath { get; }
        string FolderLabel { get; }
        IEnumerable<IFolder> Folders { get; }
    }
}
